//
//  ViewController.swift
//  SaibaotongApp
//
//  Created by 陈少 on 2017/9/15.
//  Copyright © 2017年 saibaotong. All rights reserved.
//

import UIKit

class ViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        addTabViewController("First", "首页", "tabbar_discover")
        addTabViewController("Insure", "更多", "tabbar_discover")
        addTabViewController("Personal", "我的", "tabbar_profile")
    }
    
    func addTabViewController(_ sbName: String, _ title: String,_ imgName: String) {
        let sb = UIStoryboard(name: sbName, bundle: nil)
        let nav = sb.instantiateInitialViewController()! as! UINavigationController
        
        nav.topViewController?.title = title
        nav.tabBarItem.image = UIImage(named: imgName)
        nav.tabBarItem.selectedImage = UIImage(named: imgName+"_highlight")
        
        addChildViewController(nav)
        
    }
    

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

